<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div id="app">
    <button @click="login">登录</button>
    <button @click="order">订单</button>

</div>
<script src="http://47.106.66.89:8080/js/vue.min.js"></script>
<script src="http://47.106.66.89:8080/js/axios.min.js"></script>
<link  href="http://47.106.66.89:8080/js/ele-2.15.7/theme-chalk/index.css" rel="stylesheet">
<script src="http://47.106.66.89:8080/js/ele-2.15.7/index.js"></script>
<script>
    var v = new Vue({
        el : "#app",
        data : {
            jwt : "",
        },
        created() {},
        methods : {
            login() {
                axios.get("/user/login?name=yc&pwd=123").then(res=>{
                    let msg = res.data;
                    alert(msg);
                    let arr = msg.split("!");

                    this.jwt = arr[1];

                })
            },
            order() {
                axios.get("/spring-cloud-order/order",{
                    headers : {
                        Authorization : this.jwt
                    }
                }).then(res=>{
                    alert(res.data);

                });
            }
        }
    })
</script>

</body>
</html>